# coding=utf-8
class Solution:
    def twoSum(self, nums: list, target: int) -> list:
        lens = len(nums)
        for i in range(lens):
            if target - nums[i] in nums:
                if (nums.count(nums[i]) == 1) and (target - nums[i] == nums[i]):
                    continue
                else:
                    j = nums.index(target - nums[i], i + 1)
                    return [i, j]
            else:
                return []
